package com.diandian.backend.order.service;

import com.diandian.backend.order.dto.OrderOfflineDouyinLifeAddParamDTO;
import com.diandian.backend.order.mapper.OrderOfflineDouyinMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class OrderOfflineDouyinLifeService {

    @Autowired
    private OrderOfflineDouyinMapper orderOfflineDouyinMapper;

    public void deleteByOfflineOrderNum(String belong, String offlineOrderNum) {
        orderOfflineDouyinMapper.deleteByOfflineOrderNum(belong, offlineOrderNum);
    }

    public void batchAdd(List<OrderOfflineDouyinLifeAddParamDTO> dataList) {
        if(dataList == null || dataList.size() == 0) {
            return;
        }
        dataList.forEach(x -> {
            x.setDel(0);
            x.setCreateTime(new Date());
        });
        orderOfflineDouyinMapper.batchAdd(dataList);
    }
}
